home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr52
/
achoice.zip
/
TEST.PRG
< prev
Wrap
Text File
|
1993-04-01
|
4KB
|
135 lines
* Program..: TEST.PRG
* Author...: Harry F. Gilbert
* Date.....: 2/9/88
* Purpose..: Test ACHOICE() in Clipper S'87 Compiler
* Notes....: Thanks to Harry Van Tassell for definition of "standard colors"
PUBLIC StdVideo,RevVideo,BorVideo,UlineVideo
PUBLIC BriteVideo,BlinkVideo,NoSelVideo
PUBLIC m_file,m_ndx,m_fld,m_prompt,m_alias
* Define "standard colors"
StdVideo = "GR+/B" && Yellow/Blue
RevVideo = "W/R" && White/Red
BorVideo = "B" && Blue
UlineVideo = "W+/B" && Brite White/Blue
BriteVideo = "BG+/B" && Brite Cyan/Blue
BlinkVideo = "W*/R" && Blink White/Red
NoSelVideo = "R/W" && Red/White
AllVideo = StdVideo+","+RevVideo+","+BorVideo+",,"+NoSelVideo
SET COLOR TO &AllVideo
DO Newscreen WITH "TEST PROGRAM","001"
m_file = "ORG"
m_ndx = "ORG"
m_fld = "Org_No"
m_alias = "ORG"
IF FILE("&m_file..NTX")
USE &m_file INDEX &m_ndx ALIAS &m_alias
ELSE
DO Window1 WITH "Indexing " + m_file + " file","Please Be Patient"
USE &m_file ALIAS &m_alias
INDEX ON &m_fld TO &m_ndx
ENDIF
GO TOP && S'87 indexing leaves file pointer at EOF()
orglist = ""
DECLARE A1[Reccount()] && Array of Organization Numbers
FOR i = 1 TO Reccount() && Fill Org Number array
A1[i] = " " + LTRIM(RTRIM(STR(Org->Org_No,6)))
SKIP
NEXT
menuchoice = 1 && Initialize menuchoice
relative = 0 && Initial relative window row
@ 9,29 TO 16,36 DOUBLE && Draw a box
DO WHILE menuchoice <> 0
menuchoice = ACHOICE(10,30,15,35,A1,.T.,"Rules",menuchoice,relative)
IF menuchoice = 0 && <ESC> was pressed; leave loop
EXIT
ENDIF
* Now toggle selected marker when <Enter> was pressed
A1[menuchoice] = IIF(SUBSTR(A1[menuchoice],1,1)=" ",;
"* "+SUBSTR(A1[menuchoice],3)," "+SUBSTR(A1[menuchoice],3))
ENDDO
FOR i = 1 TO Reccount() && Create list of selected organizations
IF SUBSTR(A1[i],1,1) = "*"
orglist = orglist + SUBSTR(A1[i],3) + ","
ENDIF
NEXT
Orglist = SUBSTR(Orglist,1,LEN(Orglist)-1) && Remove trailing comma
@ 20,5
@ 20,5 SAY "Orgs Chosen are: " + Orglist
CLOSE DATABASES
CLEAR ALL
RETURN
QUIT
FUNCTION Rules && The UDF used by ACHOICE()
PARAMETERS mode,element,position && Passed by ACHOICE()
DO CASE
CASE lastkey() = 27
reply = 0
CASE lastkey() = 13
reply = 1
OTHERWISE
reply = 2
ENDCASE
relative = position
RETURN (reply)
PROCEDURE Newscreen && My "standard" screen
PARAMETERS banner,snum
CLEAR
@ 1, 0 SAY TRIM(Banner)
IF EMPTY(snum)
@ 1,72 SAY DTOC(date())
ELSE
@ 1,72 SAY "[ "+TRIM(snum)+" ]" && A "screen number" for help reference
ENDIF
@ 2, 0 SAY REPLICATE(CHR(205),80)
@ 19, 0 SAY REPLICATE(CHR(196),80)
RETURN
* EOP: newscreen
PROCEDURE Window1 && Pop-up window, remains on screen for
PRIVATE msg1,msg2 && 10 seconds or until key is pressed
STORE " " TO msg1,msg2
IF PCOUNT() = 1 && How many message lines were passed?
PARAMETERS msg1
ELSE
PARAMETERS msg1,msg2
ENDIF
SAVE SCREEN
SET COLOR TO &RevVideo
SET CURSOR OFF
@ 6,10 CLEAR TO 16,69
@ 6,10 TO 16,69 DOUBLE
@ 9,(40-INT(LEN(msg1)/2)) SAY msg1
IF .NOT. EMPTY(msg2)
@ 11,(40-INT(LEN(msg2)/2)) SAY msg2
ENDIF
TONE(800,5)
TONE(400,5)
mtime = INKEY(10)
SET COLOR TO &StdVideo
RESTORE SCREEN
SET CURSOR ON
RELEASE mtime,msg1,msg2
RETURN
* EOP: window1